package com.stox.audit;

import java.util.Date;

import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;

public class AuditableEntityListener<U> {

	@PrePersist
	public void prePersist(Auditable<U> auditable){
		//auditable.setCreatedBy(SecurityContextHolder.getContext().getPrincipal());
		auditable.setCreatedDate(new Date());
	}
	
	@PreUpdate
	public void preUpdate(Auditable<U> auditable){
		auditable.setLastModifiedDate(new Date());
	}
	
}
